
#ifndef GPS_PROTO_GPS_PARSER_UTIL_H_
#define GPS_PROTO_GPS_PARSER_UTIL_H_

#include "boost/scoped_ptr.hpp"
#include "attributes.h"
#include "gps.pb.h"

namespace gps_proto {

class GpsParserUtil {
 public:
  static bool ParseLatLonAttrs(const char** atts, PointProto* point_proto) {
    boost::scoped_ptr<Attributes> attributes(Attributes::Create(atts));
    if (!attributes.get()) {
      return false;
    }
    if (point_proto) {
      double lat;
      double lon;
      if (attributes->GetDouble("lat", &lat)) {
        point_proto->set_lat(lat);
      }
      if (attributes->GetDouble("lon", &lon)) {
        point_proto->set_lon(lon);
      }
    }
    return true;
  }
};

}  // end namespace gps_proto

#endif  // define GPS_PROTO_GPS_PARSER_UTIL_H_

